package WaiBao;

import java.util.Arrays;

public class ShnegYuLe {
    public static void main(String[] args) {
        String[] name = {"孔融(班长)", "商鞅(团支书)", "小李(学习委员)", "刘中元(体育委员)", "司马相如", "王之涣", "陆游", "刘长卿", "欧阳修", "朱元璋", "王安石", "范仲淹",
                "铁木真", "刘邦", "武则天", "文天祥", "韩愈", "王子焕", "杨玉环", "王伟", "白居易", "杜甫", "卓文君", "貂蝉", "赛金花", "张居正", "司马迁", "刘琦",
                "庄子", "申宇乐(学生)"};//考生本人:申宇乐(学生)
        int[] age = {21,19,21, 21,18,21, 21, 19, 18, 20, 21, 20, 18, 20, 21, 19, 18, 19, 18, 20, 19, 19, 20, 20, 20, 18, 22, 18, 20, 20};//考生年龄：20

        double[] langbian1 = {81, 76, 59, 85, 74, 68, 76, 80, 68, 80, 90, 77, 85, 79, 64, 68, 69, 99, 96, 80, 92, 91, 90, 85, 75, 74, 74, 89, 77, 96};
        double[] langbian2 = {79, 86, 84, 86, 76, 86, 74, 88, 74, 74, 94, 67, 84, 75, 95, 65, 86, 79, 66, 78, 82, 71, 85, 87, 75, 89, 74, 74, 80, 96};
        double[] langbian3 = {82, 83, 89, 74, 85, 75, 63, 69, 80, 69, 73, 87, 85, 85, 65, 98, 89, 79, 96, 63, 92, 81, 95, 85, 76, 88, 73, 78, 79, 96};


        double rumor1;//代表每个学生的总分
        double rumor2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            rumor1 =  langbian1[i] + langbian2[i] + langbian3[i];
//            rumor2 = (rumor1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +rumor1);
//            System.out.println(name[i] + "的平均分为:" + rumor2);
//        }

        double year1 = 0,year2 = 0;
        double[] wanan = new double[30];
//        for (int i = 0; i < 30; i++) {
//            year1 = langbian1[i] +  langbian2[i] + langbian3[i];
//            year2  = (year1 * 1.0) / 3;
//            wanan[i] = year2;
//        }
//
//        for (int i = 0; i <wanan.length - 1; i++) {
//            for (int j = 0; j < wanan.length - i - 1; j++) {
//                if (wanan[j] < wanan[j + 1]) {
//                    double tep =wanan[j];
//                    wanan[j] =wanan[j + 1];
//                    wanan[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(wanan[i]);
//        }



        double huawei1 = 0,huawei2 = 0, huawei3 = 0;//计算每门课的平均分
        double pingguo1 = 0,pingguo2 = 0,pingguo3 = 0;//计算每门课标准差
        double manguo1 = 0, manguo2 = 0, manguo3 = 0;//计算每门课中位数
        double sap = 0;
        for (int i = 0; i < langbian1.length; i++) {
            sap+=langbian1[i];
        }
        huawei1 = (sap*1.0)/30;
        System.out.println("分析化学的班级平均分为:"+ huawei1);
        double Sum = 0;
        for (int i = 0; i < langbian2.length; i++) {
            Sum+=langbian2[i];
        }
        huawei2 = (Sum*1.0)/30;
        System.out.println("线性代数的班级平均分为:"+huawei2);
        double sum = 0;
        for (int i = 0; i <langbian3.length; i++) {
            sum+=langbian3[i];
        }
        huawei3 = (sum*1.0)/30;
        System.out.println("有机化学的班级平均分为:"+huawei3);




        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <langbian1.length; i++) {
            c1+= (langbian1[i] - huawei1)*(langbian1[i] - huawei1);
        }
        pingguo1 = Math.sqrt(c1*1.0/30);
        System.out.println("分析化学的班级标准差为:"+pingguo1);

        for (int i = 0; i <langbian2.length; i++) {
            c2+= (langbian2[i] - huawei2)*(langbian2[i] -huawei2);
        }
        pingguo2 = Math.sqrt(c2*1.0/30);
        System.out.println("线性代数的班级标准差为:"+pingguo2);

        for (int i = 0; i <langbian3.length; i++) {
            c3+= (langbian3[i] - huawei3)*(langbian3[i] -huawei3);
        }
        pingguo3 = Math.sqrt(c3*1.0/30);
        System.out.println("有机化学的班级标准差为:"+pingguo3);
//////////
////////
////////
//        Arrays.sort(langbian1);
//        Arrays.sort(langbian2);
//        Arrays.sort(langbian3);
//        manguo1 =( langbian1[14]+langbian1[15])*1.0/2;
//        manguo2 =(langbian2[14]+langbian2[15])*1.0/2;
//        manguo3 =(langbian3[14]+langbian3[15])*1.0/2;
//        System.out.println("分析化学的中位数为:"+  manguo1);
//        System.out.println("线性代数的中位数为:"+ manguo2);
//        System.out.println("有机化学学的中位数为:"+ manguo3);







    }
}
